//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package zhoufu.sz.sanxiao_check.utils;

import ezy.boost.update.ICheckAgent;
import ezy.boost.update.IUpdateChecker;
import ezy.boost.update.UpdateError;
import ezy.boost.update.UpdateUtil;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

public class UpdateChecker implements IUpdateChecker {
  public void check(ICheckAgent agent, String url) {
    HttpURLConnection connection = null;
    try {
      connection = (HttpURLConnection) (new URL(url)).openConnection();
      connection.setRequestMethod("GET");
      connection.connect();
      if (connection.getResponseCode() == 200) {
        agent.setInfo(UpdateUtil.readString(connection.getInputStream()));
      } else {
        agent.setError(new UpdateError(2005, "" + connection.getResponseCode()));
      }
    } catch (IOException var8) {
      var8.printStackTrace();
      agent.setError(new UpdateError(2004));
    } finally {
      if (connection != null) {
        connection.disconnect();
      }
    }
  }
}
